package com.heima.client;

import com.heima.apis.ArticleApi;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.vos.Result;
import com.heima.service.ArticleService;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author itheima
 * @since 2023-01-04
 */
@RestController
public class ArticleClient implements ArticleApi {

    @Autowired
    private ArticleService articleService;

    @PostMapping("/api/v1/article/save")
    public Result saveArticle(@RequestBody ArticleDto articleDto) throws Exception {
        return Result.success(articleService.saveArticle(articleDto));
    }

}
